home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / bc-1_02.lha / bc-1.02 / Test / checklib.b < prev    next >
Text File  |  1991-12-16  |  1KB  |  110 lines

  1. define t (x,y,d,s,t) {
  2.    auto u, v, w, i, b, c;
  3.  
  4.    if (s >= t) {
  5.      "Bad Scales. Try again.
  6. ";   return;
  7.    }
  8.  
  9.    for (i = x; i < y; i += d) {
  10.      scale = s;
  11.      u = f(i);
  12.      scale = t;
  13.      v = f(i);
  14.      scale = s;
  15.      w = v / 1;
  16.      b += 1;
  17.      if (u != w) {
  18.        c += 1;
  19. "
  20. Failed:  
  21. "
  22.        "  index = "; i;
  23.        "  val1 = "; u;
  24.        "  val2 = "; v;
  25. "
  26. "
  27.      }
  28.    }
  29.  
  30. "
  31. Total tests:    "; b;
  32. "
  33. Total failures: "; c;
  34. "
  35. Percent failed: "; scale = 2; c*100/b;
  36.  
  37. }
  38.  
  39.  
  40. "
  41. Checking e(x)"
  42. define f(x) {
  43.   return (e(x))
  44. }
  45. "
  46. scale = 10"
  47. j = t(-50,50,1,10,14)
  48. "
  49. scale = 20"
  50. j = t(-50,50,1,20,24)
  51.  
  52. "
  53. Checking l(x)"
  54. define f(x) {
  55.   return (l(x))
  56. }
  57. "
  58. scale = 10"
  59. j = t(1,10000,100,10,14)
  60. "
  61. scale = 20"
  62. j = t(1,10000,100,20,24)
  63.  
  64. "
  65. Checking s(x)"
  66. define f(x) {
  67.   return (s(x))
  68. }
  69. "
  70. scale = 10"
  71. j = t(0,8*a(1),.01,10,14)
  72. "
  73. scale = 20"
  74. j = t(1,8*a(1),.01,20,24)
  75.  
  76. "
  77. Checking a(x)"
  78. define f(x) {
  79.   return (a(x))
  80. }
  81. "
  82. scale = 10"
  83. j = t(-100,100,1,10,14)
  84. "
  85. scale = 20"
  86. j = t(-100,100,1,20,24)
  87.  
  88. "
  89. Checking j(n,x)"
  90. define f(x) {
  91.   return (j(n,x))
  92. }
  93. "
  94. n=0, scale=10"
  95. n=0
  96. j = t(0,30,.1,10,14)
  97. "
  98. n=1, scale=10"
  99. n=1
  100. j = t(0,30,.1,10,14)
  101. "
  102. n=0, scale=20"
  103. n=0
  104. j = t(0,30,.1,20,24)
  105. "
  106. n=1, scale=20"
  107. n=1
  108. j = t(0,30,.1,20,24)
  109.  
  110.